<template>
	<view>
		<view class="boxconet">
			<u-swipe-action :index="index" v-for="(item, index) in listData" :key='index'>
				<view class="item u-border-bottom" >
					<image mode="aspectFill" :src="item.img" />
					<view class="title-wrap">
						<text class="title u-line-2">{{ item.nickname }}</text>
					</view>
					<view class="time" @click="clickIndex(item)">
						同意
					</view>
				</view>
			</u-swipe-action>
			<view v-if="listData.length === 0">无数据</view>
		</view>
	</view>
</template>

<script>
	import {
		getState
	} from "../../../../../store";
	export default {
		data() {
			return {
				friend_I: '',
				listData: [],
			}
		},
		onLoad() {
			const {
				usermali
			} = getState('user', 'userInfo');
			this.friend_I = usermali;
			this.getuserlist()
		},
		onPullDownRefresh() {
			// uni.stopPullDownRefresh();
			this.getuserlist()
		},
		methods: {
			async clickIndex({
				friend_id,
				friend_type
			}) {
				await this.http(this.api.myuserupdate, {
					friend_type: 1,
					friend_id
				}).catch(()=>{
					
				})
				this.getuserlist()
			},
			async getuserlist(data) {
				this.listData = await this.http(this.api.myuserlist, {
					friend_I: this.friend_I,
					type: 2
				})
				uni.stopPullDownRefresh();
			}
		},
	}
</script>

<style scoped lang="less">
	@import '../../../../../static/css/common.less';

	.title_msg {
		font-family: PingFangSC-Semibold;
		font-size: 22px;
		color: #272832;
		letter-spacing: -0.75px;
		margin-left: 20rpx;
	}

	.item {
		display: flex;
		padding: 20rpx;
	}

	.add_time {
		background: rgba(74, 170, 255, 0.10);
		border-radius: 12px;
		border-radius: 12px;
		color: #4AAAFF;
		width: 20%;
		height: 50rpx;
		.centered();
	}

	image {
		width: 80rpx;
		flex: 0 0 80rpx;
		height: 80rpx;
		margin-right: 20rpx;
		border-radius: 12rpx;
	}

	.title {
		text-align: left;
		font-size: 28rpx;
	}

	.title-wrap {
		display: flex;
		align-items: center;
		justify-content: left;
		width: 60%;
	}

	.time {
		background: #FFE431;
		border-radius: 12rpx;
		width: 20%;
		height: 50rpx;
		.centered();
	}
</style>
